<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns="http://www.w3.org/1999/XSL/Format"
	xmlns:dg="livcos.org/ns/doc/diagram"
	xmlns:doc="livcos.org/ns/doc"
	xmlns:svg="http://www.w3.org/2000/svg"
	xmlns:xlink="http://www.w3.org/1999/xlink"
	xmlns:f="livcos.org/ns/xslt/function"
	exclude-result-prefixes="dg f doc svg xlink">

	<xsl:import href="/livcos.org/web/diagram/render.xsl"/>
	
	<xsl:param name="diagram_scale" select="'scale-down-to-fit'"/>

	<xsl:template match="dg:diagram">
		<block margin-left="1mm" margin-top="1pt" margin-right="1mm" margin-bottom="1pt">
			<instream-foreign-object width="100%" content-width="{$diagram_scale}" text-align="center">
				<xsl:apply-imports/>
			</instream-foreign-object>
		</block>
		<xsl:if test="normalize-space(doc:note) != ''">
			<block margin-left="6mm" margin-top="4pt" margin-right="4mm" margin-bottom="4pt">
				<xsl:value-of select="doc:note"/>
			</block>
		</xsl:if>
	</xsl:template>
	
	<xsl:template match="svg:image/@xlink:href" mode="render">
		<xsl:copy/>
	</xsl:template>
	
</xsl:stylesheet>